package it.unibo.is.domoticaContact;

import it.unibo.contact.platform.InteractPolicy;
import it.unibo.contact.platform.PlatformExpert;
import it.unibo.is.interfaces.*;
import it.unibo.is.interfaces.platforms.*;
import java.util.Vector;
	

public abstract class  ReceiverSupport extends Subject{
	/* -------------------------------------
	* Local state of the subject
	* --------------------------------------
	*/
	
	protected String M = "someContent";	
	protected int lastMsgNum = 0; 
	private Receiver obj = null; //The user must define Receiver
//	private  IOutputView view;
	protected Vector<IMessage> inpList;
	
	/* -------------------------------------
	* OPERATIONS
	* --------------------------------------
	*/
	
	
	
	protected IMessage receiverServe_consumptionData() throws Exception{
		IOpIn support = PlatformExpert.findInSupport("receiver","consumptionData",false );
		IMessage m =  support.serve( "receiver", "consumptionData", InteractPolicy.nopolicy()  ); 
		//showMessage( "serving" , m );
		return m;
	}
		
	/* -------------------------------------
	* Local body of the subject
	* --------------------------------------
	*/
 
	protected abstract void doJob() throws Exception;	/*{
	[it.unibo.is.contact.impl.serveDispatchImpl@3ca754]
	[]
 	 //	INPUT
   	prepareInput();
   	IMessage mm = selectOneInput(lastMsgNum, inpList);
   	elab(mm.msgId());
	//	OUTPUT
 	}  */	

	


	

	
	/* -------------------------------------
	* Termination
	* --------------------------------------
	*/
	
protected void terminate() throws Exception{

	receiverServe_consumptionDataEnd();
	
//showMsg("  *** TERMINATED *** ");
}
//Teminate operations

	
	
	protected void receiverServe_consumptionDataEnd() throws Exception{
		IOpIn support = PlatformExpert.findInSupport("receiver","consumptionData",false );
		support.terminate();
	}
	

}
